import pygame
from pygame.locals import *

from Widget import *

class Image(Widget):
   """ 
      Generic Image widget. 
   """
   def __init__(self, rect, image):
      Widget.__init__(self)
      self.image = image
      self.rect = pygame.Rect(rect[0], rect[1], rect[2], rect[3])
   def draw(self):
      self.screen.blit(self.image, 
         (  self.parent.rect.x+self.rect.x, 
            self.parent.rect.y+self.rect.y, 
            self.rect.w, 
            self.rect.h))
      for child in self.children:
         child.draw()